angular.module('nm.service', [
    ])
.factory('Monitors',['$http', function( $http){
    return {
        getMonitors: function(opts, callback){
            callback([
                {
                    title:'sohu',url:'http://www.sohu.com/',
                    interval:18000,timeout:5000,treads:1,
                    lastState:2,runTimes:3332,id:'586658d0-4d6b-11e5-b7a8-49e9b8f95365'

                }
            ]);
        }              
    };
}])
.factory('Users',['$http' , function($http){
    return {
        get: function(opts, callback){
            
            $http.get('/_api/user').
                success(function(data, status, headers, config) {
                    callback(data);
                }).
                error(function(data, status, headers, config) {
                    callback(data);
                });            
        },

        add: function(user, callback){
            
            $http.post('/_api/user' ,user).
                success(function(data, status, headers, config) {
                    callback(data);
                }).
                error(function(data, status, headers, config) {
                    callback(data);
                });  
        }
    };
}])


;

